<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group(['prefix' => 'user'], function () {
    Route::post('/save', 'UserController@save');
    Route::get('/delete', 'UserController@delete');
    Route::get('/list', 'UserController@list');
    Route::get('/one', 'UserController@one');
    Route::post('/login', 'UserController@login');
    Route::post('/register', 'UserController@register');
    Route::get('/checkUsername', 'UserController@checkUsername');
});

Route::group(['prefix' => 'book'], function () {
    Route::post('/save', 'BookController@save');
    Route::get('/delete', 'BookController@delete');
    Route::get('/list', 'BookController@list');
    Route::get('/one', 'BookController@one');
    Route::get('/hot', 'BookController@hot');
    Route::get('/new', 'BookController@new');
    Route::get('/search', 'BookController@search');
    Route::get('/category', 'BookController@category');
    Route::get('/test', 'BookController@test');
});

Route::group(['prefix' => 'category'], function () {
    Route::post('/save', 'CategoryController@save');
    Route::get('/delete', 'CategoryController@delete');
    Route::get('/list', 'CategoryController@list');
    Route::get('/one', 'CategoryController@one');
    Route::get('/category', 'CategoryController@category');
});

Route::group(['prefix' => 'banner'], function () {
    Route::post('/save', 'BannerController@save');
    Route::get('/delete', 'BannerController@delete');
    Route::get('/list', 'BannerController@list');
    Route::get('/one', 'BannerController@one');
});
